import {ArticleInfo} from "@/entity/article/article";
import {PageInfo, Response} from "@/entity/net";
import {BaseService} from "@/service";

/**
 * 获取当个文章信息
 * @param articleId
 */
export const GetArticleInfo = (articleId: string): Response<ArticleInfo> => {
    return BaseService.get("/article/info", {params: {"articleId": articleId}});
};

/**
 * 获取文章列表信息
 * @param pageinfo
 */
export const GetArticleList = (pageinfo: PageInfo): Response<ArticleInfo[]> => {
    return BaseService.get("/article/list", {params: pageinfo});
};

/**
 * 文章创建接口
 * @param article
 */
export const CreateArticle = (article: ArticleInfo): Response<null> => {
    return BaseService.post("/article/create", article);
};

/**
 * 更新文章接口
 * @param article
 */
export const UpdateArticle = (article: ArticleInfo): Response<null> => {
    return BaseService.post("/article/update", article);
};

/**
 * 删除文章
 * @param articleId
 */
export const DeleteArticle = (articleId: number): Response<null> => {
    return BaseService.delete("/article/delete", {params: {"articleId": articleId}});
};